/*
 * ColorRenderer.java
 *
 * Created on December 13, 2007, 12:10 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.fie.renderer;

import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.*;
import java.awt.*;
 
public class LastRenderer
  extends DefaultTableCellRenderer
{
  private int columns;
  private String ticker;
  private Color setColor;
  private Color prevColor;
  private int inRow;
  private float last;
  private float nLast;
  
  public  LastRenderer(int col)
  {
    columns = col;   
  }
	
  public synchronized Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column){
        setText(String.valueOf(value));
        
        Object objValue = table.getValueAt(row, columns);
                if (objValue.equals("+")){                   
                   setBackground(new Color(0,255,0));
                   return (this);
                }
                else if(objValue.equals("-")){
                   setBackground(new Color(255,0,0));
                   return (this);
                }
        
        
        
        this.setBackground(new Color(255,165,0)); // All columns verified were empty - set our background RED
        return this;
    }
  
}